#! /usr/bin/python3
# author ckm
import asyncio
import aiohttp  # 异步 HTTP 库

async def my_downLoad(url):
    print('GET: %s' % url)
    async with aiohttp.ClientSession() as session:  # 创建异步会话
        async with session.get(url) as response:  # 异步请求
            data = await response.read()  # 异步读取响应内容
            print('%d bytes received from %s.' % (len(data), url))

async def main():
    urls = [
        'http://www.baidu.com/',
        'http://www.cskaoyan.com/',
        'http://www.qq.com/'
    ]
    tasks = [asyncio.create_task(my_downLoad(url)) for url in urls]  # 创建任务列表
    await asyncio.gather(*tasks)  # 等待所有任务完成

asyncio.run(main())